#include "engine.h"

SDL_Surface *engine::screen;
SDL_Rect engine::scr_rect;

int engine::init(short w, short h, short bpp){
	//SDL initalization
	if(SDL_Init(SDL_INIT_VIDEO) == -1){
		return -1;
	}
	
	//clean up when exiting
	atexit(SDL_Quit);

	//create 800x600 8bpp surface in hardware memory with double buffering 
	screen = SDL_SetVideoMode(w, h, bpp, SDL_HWSURFACE|SDL_DOUBLEBUF);
	if(screen == NULL){
		return -1;
	}

	//create rectangle 
	scr_rect.x = 0;
	scr_rect.y = 0;
	scr_rect.w = w;
	scr_rect.h = h;

	return 0;
}

void engine::swap(){
	SDL_Flip(screen);
}
